home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
scroll_s
/
scroll.frm
< prev
next >
Wrap
Text File
|
1997-07-26
|
4KB
|
131 lines
VERSION 4.00
Begin VB.Form Form1
BorderStyle = 1 'Fixed Single
Caption = "By Kevin Smith EMAIL: kjsmith@ozemail.com.au"
ClientHeight = 4170
ClientLeft = 2340
ClientTop = 2805
ClientWidth = 6690
Height = 4575
Icon = "scroll.frx":0000
Left = 2280
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4170
ScaleWidth = 6690
Top = 2460
Width = 6810
Begin VB.Timer Timer1
Left = 180
Top = 3180
End
Begin VB.HScrollBar HScroll1
Height = 195
Left = 180
TabIndex = 2
Top = 3960
Width = 6375
End
Begin VB.PictureBox Picture2
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 3285
Left = -120
Picture = "scroll.frx":0442
ScaleHeight = 3255
ScaleWidth = 19200
TabIndex = 1
Top = 4560
Width = 19230
End
Begin VB.PictureBox Picture1
Height = 1935
Left = 240
ScaleHeight = 217
ScaleMode = 0 'User
ScaleWidth = 409
TabIndex = 0
Top = 240
Width = 6195
End
Begin VB.Label Label3
Alignment = 2 'Center
BackStyle = 0 'Transparent
Height = 195
Left = 600
TabIndex = 3
Top = 3660
Width = 5835
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Const SRCCOPY = &HCC0020
Const PIXELS = 3
Private Sub Form_Load()
' Center the Form
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
' Set the Scale Mode to PIXELS (3) the modes are:
'0 Indicates that one or more of the ScaleHeight, ScaleWidth, ScaleLeft, and ScaleTop properties are set to custom values.
'1 (Default) Twip (1440 twips per logical inch; 567 twips per logical centimeter).
'2 Point (72 points per logical inch).
'3 Pixel (smallest unit of monitor or printer resolution).
'4 Character (horizontal = 120 twips per unit; vertical = 240 twips per unit).
'5 Inch.
'6 Millimeter.
'7 Centimeter.
' BitBlt uses the PIXEL Mode.....
Picture1.ScaleMode = PIXELS
Picture2.ScaleMode = PIXELS
' Make Picture1 the same height as Picture2 (217 pixels in this demo)
Picture1.Height = Picture2.Height
' Make The Maxium Scrolling rate 40 pixels at a time
HScroll1.Max = 40
HScroll1.LargeChange = 2
' Kick start the Timer
Timer1.Interval = 10
End Sub
Private Sub Label2_Click()
End Sub
Private Sub Timer1_Timer()
Label3.Caption = "Scroll Speed = " & HScroll1
Static x As Integer
Dim AWidth As Integer
Dim rc As Integer ' used for return code for BltBit
' Calaculate the next x position for picture 2
x = x + HScroll1
If x > Picture2.ScaleWidth Then x = 0
If x > (Picture2.ScaleWidth - Picture1.ScaleWidth) Then
AWidth = Picture2.ScaleWidth - x
rc = BitBlt(Picture1.hDC, 0, 0, AWidth, Picture2.ScaleHeight, Picture2.hDC, x, 0, SRCCOPY)
rc = BitBlt(Picture1.hDC, AWidth, 0, Picture1.ScaleWidth - AWidth, Picture2.ScaleHeight, Picture2.hDC, 0, 0, SRCCOPY)
Else
rc = BitBlt(Picture1.hDC, 0, 0, Picture1.ScaleWidth, Picture2.ScaleHeight, Picture2.hDC, x, 0, SRCCOPY)
End If
End Sub